/*** 
 * @_______________#########_______________________ 
 * @______________############_____________________ 
 * @______________#############____________________ 
 * @_____________##__###########___________________ 
 * @____________###__######_#####__________________ 
 * @____________###_#######___####_________________ 
 * @___________###__##########_####________________ 
 * @__________####__###########_####_______________ 
 * @________#####___###########__#####_____________ 
 * @_______######___###_########___#####___________ 
 * @_______#####___###___########___######_________ 
 * @______######___###__###########___######_______ 
 * @_____######___####_##############__######______ 
 * @____#######__#####################_#######_____ 
 * @____#######__##############################____ 
 * @___#######__######_#################_#######___ 
 * @___#######__######_######_#########___######___ 
 * @___#######____##__######___######_____######___ 
 * @___#######________######____#####_____#####____ 
 * @____######________#####_____#####_____####_____ 
 * @_____#####________####______#####_____###______ 
 * @______#####______;###________###______#________ 
 * @________##_______####________####______________ 
 * @
 * @Author: ipk518 18163976442@163.com
 * @Date: 2024-06-19 10:31:14
 * @LastEditors: ipk518 18163976442@163.com
 * @LastEditTime: 2024-11-28 16:07:44
 * @FilePath: /etws-sxk2307V1.3/src/Service/sdsProtocolTask.cpp
 * @Description: 
 * @************佛祖保佑************
 * @Copyright (c) 2024 by etws@quyujiang, All Rights Reserved. 
 */

#include "Server.h"
#include "sdsCmdV1.h"
#include "packetResolver.hpp"

void Server::sdsProtocolTask(Server *args)
{
	bool m_sdsRes = false;
	pthread_setname_np(pthread_self(),"sdsProtocolTask");
	while(args->isRunning)
	{
		if (sysRunStatus == SYS_INIT) {
			qlog_d("sds解析线程等待运行..");
            std::this_thread::sleep_for(std::chrono::milliseconds(600));
            continue;
		}
		m_sdsRes = args->sdsPort->wait();
		if	(m_sdsRes) {
			auto data = args->sdsPort->take();
			{
				
				sdsProtocolAnalysis(data->cmdHead,data->dataEntity);
				
			}
            // data->cmdHead->dst_DevType = data->cmdHead->source_DevType;
			// data->cmdHead->dst_DevNum = data->cmdHead->source_DevNum;
			// data->cmdHead->source_DevType = CurDeviceType;
			// data->cmdHead->source_DevNum = ComponentNO;
			// data->cmdHead->dataLen  = 0;
            
			// args->m_serverDds->publish(data->cmdHead,data->dataEntity);
			args->sdsPort->release(data);
		}
		m_sdsRes = false;
	}
}